// 此文件专门管理一些请求比较少的情况下，多个页面共同使用的封装
import {request, request_l} from './network.js'
// 获取商品列表的
export function getListData(params) {
	return request({
		url: '/goods/search',
		data:params
	})
}


// 获取商品详情

export function getGoodsDetail(goods_id) {
	return request({
		url: '/goods/detail',
		data:{
      goods_id
    }
	})
}


// 获取商品详情
// http://121.37.195.155/test/public/
export function networkTest() {
	return request({
		url: 'http://121.37.195.155/test/public/'
	},true)
}


export function getToken(params){
  return request({
    url: '/users/wxlogin',
    data:params,
    method:'post'
	})
}
export function goodsQuery (data){
  return request_l({
    url: 'index/Miniprogram/goodsQuery',
    data,
	})
}

export function getGoodsDetail_l(gid){
  return request_l({
    url: 'index/Miniprogram/getGoodsDetail',
    data:gid,
	})
}


export function getGoodsItem(gid){
  return request_l({
    url: 'index/Miniprogram/getGoodsItem',
    data:gid,
	})

}

export function checkOrder(data){
  return request_l({
    url: 'index/Miniprogram/checkOrder',
    data,
    method:'post'
	})
}


export function getOrder(data){
  return request_l({
    url: 'index/Miniprogram/getOrder',
    data,
    method:'post'
	})
}


export function checkGoods(data){
  return request_l({
    url: 'index/Miniprogram/checkGoods',
    data,
    method:'post'
	})
}

export function payloadOrder(data){
  return request_l({
    url: 'index/Miniprogram/payloadOrder',
    data,
    method:'post'
	})


}


export function addHistory(data){
  return request_l({
    url: 'index/Miniprogram/addHistory',
    data,
    method:'post'
	})
}


export function collectGoods(data){
  return request_l({
    url: 'index/Miniprogram/collectGoods',
    data,
    method:'post'
	})
}

export function getCollectGoods(){
  return request_l({
    url: 'index/Miniprogram/getCollectGoods',
    data:{
      openid:wx.getStorageSync('openid') || null
    }

	})
}